<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../../day08_09-jquery/jquery/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<button type="button">获取数据</button>
		<div style="width: 500;"></div>
		<script type="text/javascript">
			const url = "http://rap2.taobao.org:38080/app/mock/263891";
			$('button').on("click", function(){
				$.get( url + "/api/info/get", resp => {
					// 请求的响应比较慢
					// console.log(resp) // {code: 200, body: {…}}
					// console.log(resp.body.list)  // [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
					if(resp.code === 200){
						resp.body.list.forEach( ( item , index ) => {
							var newImg = document.createElement("img");
							newImg.src = item['img'];
							$('div').append(newImg);
						})
					}
				})
			})
		</script>
	</body>
</html>
